#ifndef QQ_AUDIO_VIEW
#define QQ_AUDIO_VIEW

#include <qabstractnativeeventfilter.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qscreen.h>
#include <qtimer.h>
#include <qdebug.h>

#include <ElaAppBar.h>
#include <ElaIcon.h>
#include <ElaPushButton.h>
#include <ElaText.h>
#include <ElaWidget.h>

#include "core/QQSettings.h"

#include "api/QQSystemApi.h"

#include "widget/QQIconButton.h"

class QQAudioView :public QDialog
{
	Q_OBJECT
public:
	enum class StopType
	{
		Refused = 0x00,
		Dropped = 0x01,
	};
public:
	QQAudioView(QWidget* parent = nullptr);
	~QQAudioView();
	void setTargetUserInfo(const QString& account, const QString& nickname, QPixmap pixmap);
	void startRealCommunicateAudio();
	void stopRealCommunicateAudio(QQAudioView::StopType type);
	void openThisInSender();
	void openThisInReceiver();
protected:
	void paintEvent(QPaintEvent* event)override;
	Q_TAKEOVER_NATIVEEVENT_H
signals:
	void microphone(bool checked);
	void accept(const QString& account);
	void refuse(const QString& account);
private slots:
	void doTimeOut();
	void doMicrophoneClick(bool checked);
	void doAccpectClick();
	void doCloseClick();
private:
	int mTimeCountSeconds = 0;
	QString mAccount;
	QTimer* mTimer;
	ElaAppBar* mAppBar;
	QPixmap mBackground;
	QLabel* mIconLabel;
	ElaText* mStateText;
	QQIconButton* mMicrophoneButton;
	QQIconButton* mAcceptButton;
	QQIconButton* mRefuseButton;
};

#endif // !QQ_AUDIO_VIEW
